package com.gof.example.command.macro;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/10 11:05.
 * haiming.fei@tongdun.cn
 */
public class App {

    public static void main(String[] args) {
        Adder adder = new Adder();
        Command a = new AddCommand(2, adder);
        Command b = new AddCommand(10, adder);
        Command c = new AddCommand(100, adder);
        Command c1 = new AddCommand(-100, adder);

        Multiplier multiplier = new Multiplier();
        Command d = new MutiplierCommand(30.0, multiplier);
        Command e = new MutiplierCommand(60.0, multiplier);
        Command f = new MutiplierCommand(90.0, multiplier);
        Command f1 = new MutiplierCommand(1.0 / 90, multiplier);

        Command g = new MicroCommand();
        g.addCommand(a);
        g.addCommand(b);
        g.addCommand(c);
        g.addCommand(c1);
        g.addCommand(d);
        g.addCommand(e);
        g.addCommand(f);
        g.addCommand(f1);
        g.excute();

        System.out.println(adder.getNum());
        System.out.println(multiplier.getNum());
    }
}
